<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
	</head>
	<body>
		
		<input type="button" onclick="myFunction()" value="显示警告框"/>
		<input type="button" onclick="p1()" value="显示确认框"/>
		<input type="button" onclick="p3()" value="显示提示框"/>
		
		<script>
			//警告框
			function myFunction(){
				alert("你好,我是一个警告框!");
			}
			//确认框
			function p1(){
				var r = confirm("按下按钮");
				if(r == true){
					console.log("你按下了确定按钮");
				}else{
					console.log("你按下了取消按钮");
				}
			}
			//提示框
			function p3(){
				var perdon = prompt("请输入你的名字","Harry Potter");
				if(perdon!=null && perdon!=""){
					alert("你好"+perdon+"!今天感觉如何?");
				}
			}
		</script>
	</body>
</html>